package com.solutec.tag9;

public class Thema3_ArraysErzeugen {

	public static void main(String[] args) {

		//1.
		int[] arr1 = {	}; //length = 0
		int[] arr1_1 = { 0, 0, 1, 1, 2, 2 }; //length = 6
		//arr1_1 = {2,3,4}; // Compilerfehler
		
		System.out.println("------------------------");

		//2.
		int[] arr2 = new int [0]; //length = 0
		int[] arr2_2 = new int[6];  //0,0,0,0,0,0 length = 6
		
//		arr2_2[0] = 0; // Como por defecto tiene el cero(0)
//		arr2_2[1] = 0; // por eso se pone como comentario, estas dos filas.
		arr2_2[2] = 1;
		arr2_2[3] = 1;
		arr2_2[4] = 2;
		arr2_2[5] = 2;
		
		for(int i=0;i<arr2_2.length;i++){
			System.out.print(arr2_2[i] + " " );
		}
		
		System.out.println();
		System.out.println("------------------------");
		
		//3.
		int[] arr3 = new int[]{}; // length = 0
		int[] arr3_3 = new int[]{3,3,4,4,5,5};
		arr3_3 = new int[]{ 1,2,3, }; //length = 3
		
		print(arr3_3);
		System.out.println();
//		print({1,2,3});
		print(new int []{1,2,3});
		
		System.out.println();
		System.out.println("------------------------");
		
		int[] arr4 = {
			1,	
			1,	
			2,	
			2,	
			3,	
			3,	
			4,	
			4,	
			5,	
			5, //Komma ist OK, trotzdem ist length = 10
		};
		
		print(arr4);
		
	}// end of  main

	static void print (int [] arr){
		for(int i=0;i<arr.length;i++){
			System.out.print(arr[i]+" " );
		}
	}
}
